import React, { Component } from 'react';
import { use_swiper } from '../../utils/api';
import { Swiper } from 'antd-mobile'
class myswisper extends Component {
  state = {
    picList: []
  }
  componentDidMount() {
    use_swiper().then((res) => {
      this.setState({
        picList: res.data.list
      })
    })

  }
  render() {
    return (
      <div className='swiper'>
        <Swiper autoplay loop>{this.state.picList.length > 0 && this.state.picList.map((item, index) => {
          return (
            <Swiper.Item key={index}>
              <div>
                {<img src={this.state.picList.length > 0 ? item.pic : "false"} alt="" />}
              </div>
            </Swiper.Item>
          )
        })}</Swiper>

      </div>
    );
  }
}

export default myswisper;